#include "myutil.h"

void StringToDes(const char *aStr, TDes &aTarget) {

    // FIXME: Doesn't really work for anything except US-ASCII
    // Copied from putty

    aTarget.SetLength(0);
    while ( *aStr ) {
        aTarget.Append(*aStr++);
    }
}


/* Converts a descriptor into a C string. The string needs to be pre-allocated
 * taken from the putty source code
 */
void DesToString(const TDesC &aDes, char *aTarget) {
    int i = 0;
    int len = aDes.Length();
    while ( i < len ) {
        *aTarget = (char) aDes[i];
        aTarget++;
        i++;
    }
    *aTarget = 0;
}
